package Strategy;

public class Chef {
    private ICutFruit cutMethod;

    // 设置切割方法
    public void SetCutMethod(ICutFruit cutMethod) {
        this.cutMethod = cutMethod;
    }

    // 执行切割
    public void CutFruit(String fruit) {
        if (cutMethod != null) {
            cutMethod.CutStrategy(fruit);
        } else {
            System.out.println("未设置切割方法");
        }
    }
}

